package com.db4o.servlet;

import javax.servlet.http.*;

/**
 * db4o servlet source code.
 * <br><br>Use the methods in the @link{Db4oServlet} class.
 */
class ServletSessionTerminator implements HttpSessionBindingListener
{
	private final ServletSession session;
	
	ServletSessionTerminator(ServletSession dbSession){
		session = dbSession;
	}
	
	protected void finalize () {
		session.terminate(true);
	}
	
	public void valueBound(HttpSessionBindingEvent event){
		// do nothing
	}

	public void valueUnbound(HttpSessionBindingEvent event){
		session.terminate(true);
	}
}
